<?php

/**
 * Enquete form base class.
 *
 * @package    form
 * @subpackage enquete
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseEnqueteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_enquete'  => new sfWidgetFormInputHidden(),
      'ds_pergunta' => new sfWidgetFormInput(),
      'st_enquete'  => new sfWidgetFormInput(),
      'slugenquete' => new sfWidgetFormInput(),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
      'deleted'     => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id_enquete'  => new sfValidatorDoctrineChoice(array('model' => 'Enquete', 'column' => 'id_enquete', 'required' => false)),
      'ds_pergunta' => new sfValidatorString(array('max_length' => 100)),
      'st_enquete'  => new sfValidatorString(array('max_length' => 1, 'required' => false)),
      'slugenquete' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'  => new sfValidatorDateTime(array('required' => false)),
      'updated_at'  => new sfValidatorDateTime(array('required' => false)),
      'deleted'     => new sfValidatorBoolean(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Enquete', 'column' => array('slugenquete')))
    );

    $this->widgetSchema->setNameFormat('enquete[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Enquete';
  }

}
